IF ( LIBCITYGML_USE_XERCESC )
	FIND_PACKAGE( XERCES REQUIRED )
	ADD_DEFINITIONS( -DUSE_XERCESC )
	SET( LIBXML2_INCLUDE_DIR "" )
	SET( LIBXML2_LIBRARIES "" )
ENDIF( LIBCITYGML_USE_XERCESC )

IF( LIBCITYGML_USE_LIBXML2 )
	FIND_PACKAGE( LibXml2 REQUIRED )
	FIND_PACKAGE( Iconv REQUIRED )
	ADD_DEFINITIONS( -DUSE_LIBXML2 )
	ADD_DEFINITIONS( ${LIBXML2_DEFINITIONS} )
	SET( XERCESC_INCLUDE "" )
	SET( XERCESC_LIBRARY "" )
ENDIF( LIBCITYGML_USE_LIBXML2 )

FIND_PACKAGE( GLU REQUIRED )

IF(COMMAND cmake_policy)
	cmake_policy(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)
	
ADD_DEFINITIONS( -DCITYGML_LIBRARY )

ADD_DEFINITIONS( -DLIBCITYGML_BUILD )

IF( LIBCITYGML_STATIC )
	ADD_DEFINITIONS( -DLIBCITYGML_STATIC )
ENDIF( LIBCITYGML_STATIC )

IF( LIBCITYGML_DYNAMIC )
	ADD_DEFINITIONS( -DLIBCITYGML_DYNAMIC )
ENDIF( LIBCITYGML_DYNAMIC )

SET( LIB_NAME citygml )

SET( LIBS ${XERCESC_LIBRARY} )

INCLUDE_DIRECTORIES( ../include ${XERCESC_INCLUDE} ${LIBXML2_INCLUDE_DIR} ${ICONV_INCLUDE_DIR} ${GLU_INCLUDE_PATH} )

SET( LIB_SRCS
	citymodel.cpp
	parser.cpp
	parserxercesc.cpp
	parserlibxml2.cpp
)

SET( LIB_PUBLIC_HEADERS
	../include/citygml.h
	../include/vecs.h
	./parser.h
)
  
ADD_LIBRARY( ${LIB_NAME} ${LIBCITYGML_USER_DEFINED_DYNAMIC_OR_STATIC} ${LIB_PUBLIC_HEADERS} ${LIB_SRCS} )
	
IF( MSVC_IDE )
	SET_TARGET_PROPERTIES( ${LIB_NAME} PROPERTIES PREFIX "../" )
ENDIF( MSVC_IDE )

TARGET_LINK_LIBRARIES( ${LIB_NAME} ${XERCESC_LIBRARY} ${LIBXML2_LIBRARIES} ${GLU_LIBRARY} )

INCLUDE(ModuleInstall OPTIONAL)